/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2024-11-08
 * Time: 17:58
 */
public class test1 {
    /*
    LCR 173.点名
    某班级 n 位同学的学号为 0 ~ n-1。点名结果记录于升序数组 records。假定仅有一位同学缺席，请返回他的学号。
     */

    public int takeAttendance(int[] nums) {
        int n = nums.length;
        int right= n-1;
        int left=0;
        while(left<right){
            int mid = left+(right-left)/2;
            if(nums[mid]==mid){
                left=mid+1;
            }else{
                right=mid;
            }
        }
        return left==nums[left]?left+1:left;
    }
}
